﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Text;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace NewStart
{
    public partial class SettingsForm : Form
    {
        public SettingsForm()
        {
            InitializeComponent();
            checkBox1.Checked = ShortcutsHelper.IsStartup();
            checkBox2.Checked = SettingsHelper.settings.enableAnimations;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            if (checkBox1.Checked)
                ShortcutsHelper.AddToStartup();
            else
                ShortcutsHelper.RemoveFromStartup();

            SettingsHelper.settings.enableAnimations = checkBox2.Checked;
            SettingsHelper.SaveSettings();
        }

        protected override void OnPaintBackground(PaintEventArgs pevent)
        {
            Graphics g = pevent.Graphics;
            Rectangle rBackground = new Rectangle(0, 0, this.Width, this.Height);
            System.Drawing.Drawing2D.LinearGradientBrush bBackground
               = new System.Drawing.Drawing2D.LinearGradientBrush(rBackground, Color.White, Color.LightGray, 30);
            g.FillRectangle(bBackground, rBackground);
            bBackground.Dispose();
        }

        protected override CreateParams CreateParams
        {
            get
            {
                CreateParams cp = base.CreateParams;
                cp.ClassStyle |= 0x00020000;
                return cp;
            }
        }
    }
}
